	<?php 
		$cur_year = date("Y");
		echo "<select name='nam' id='nam'>";

		for ($i=$cur_year; $i >= 1950; $i--) { 
			echo "<option value='$i'>$i</option>";
		}
		echo "</select>";
	 ?>
	 <span>Tháng</span>
	 <select name='thang' id='thang'>
	 	
	 	<option value='1'>01</option>
	 	<option value='2'>02</option>
	 	<option value='3'>03</option>
	 	<option value='4'>04</option>
	 	<option value='5'>05</option>
	 	<option value='6'>06</option>
	 	<option value='7'>07</option>
	 	<option value='8'>08</option>
	 	<option value='9'>09</option>
	 	<option value='10'>10</option>
	 	<option value='11'>11</option>
	 	<option value='12'>12</option>
	</select>
	<span>Ngày</span>
	<select name='ngay' id='ngay'>
	 	<option value=''>ngày</option>
	</select>
	<!---------------------------------------------->
	 <script>
    $(document).ready(function(){
		$('#nam').change(function(){
			getdays();
		});
		$('#thang').change(function(){
			getdays();
		});
		function getdays(){
			var max_ngay = maxday();
			var str ='';
			for (var i = 1; i<= max_ngay ; i++) {
				str += "<option value =" +i +">" +i +"</option>";
			};
			var nam = document.getElementById('ngay').innerHTML = str;
		}
		
		function maxday(){
			var nam = document.getElementById('nam').value;
			var thang = document.getElementById("thang").value;	
			switch(thang)
			{
				case '1':	
				case '3':	
				case '5':	
				case '7':	
				case '8':
				case '10':
				case '12':
					return 31;
				case '4':	
				case '6':	
				case '9':
				case '11':
					return 30;
				case '2':
					if((nam%4==0 && nam%100!=0) || nam%400==0)
						return 29;
					else return 28;
				default :
					return 0;
			}
		
		}
		
	});

 </script>
<?php 
	
	

